﻿@model WebUI.Models.QizSession
@{
    var PreviewOnly = (bool)TempData["PreviewOnly"];    //ViewBag.ForceEdit != true && "True".Equals(Request["PreviewOnly"], StringComparison.CurrentCultureIgnoreCase);
}
<div>
    <table class="width col4">
        <tr>
            <td colspan="3" class="PageTip">
                <h3>
                    @Model.QizSubject.DescForRecuper</h3>
            </td>
        </tr>
        @if (ViewBag.ForceEdit == true)
        {
            <tr>
                <td colspan="3" class="PageTip">
                    <h3 class="error">
                        部分内容填写不正确，例如必填项未填写或错误的指标值。请修改后重新提交。</h3>
                    <script language="javascript" type="text/javascript">
                        $(function () {
                            alert("部分内容填写不正确，例如必填项未填写或错误的指标值。请修改后重新提交。");
                        });
                    </script>
                    @Html.ValidationSummary()
                </td>
            </tr>
        }
        @if (PreviewOnly)
        {
            bool hastixing = false;

            if (Model.SessionAutoEvaluation == "异常" && !string.IsNullOrEmpty(Model.QizSubject.DescIfBad))
            {
                var devQizs = Model.QizSessionDetails.Where(detail => detail.ValueAutoEvaluation == "异常");
                if (devQizs != null && devQizs.Count() > 0)
                {
            <tr>
                <td colspan="3" class="PageTip" style="font-size: 11pt;">
                    <div class="error-title">
                        异常指标汇总:
                    </div>
                    <ol class="error">
                        @foreach (var item in devQizs)
                        {
                            <li>@item.QizSubjectDefine.QizItem.Title : @item.UserValue @item.QizSubjectDefine.QizItem.Unit</li>
                        }
                    </ol>
                </td>
            </tr> 
                }

                hastixing = true;
                        
            <tr>
                <td colspan="3" class="PageTip" style="font-size: 11pt;">
                    <div class="error-title">
                        随访异常常规建议:
                    </div>
                    <div class="validation-summary-errors" style="padding-left: 32px">
                        @Html.Raw(Model.QizSubject.DescIfBad.Replace("\r", "<br/>"))
                    </div>
                </td>
            </tr>
                        
            }

            if (Model.SessionAutoEvaluation != "异常" && !string.IsNullOrEmpty(Model.QizSubject.DescIfFine))
            {
                hastixing = true;
                        
            <tr>
                <td colspan="3" class="PageTip">
                    <div class="error-title">
                        随访常规建议:
                    </div>
                    <div class="validation-summary-errors" style="padding-left: 32px">
                        @Html.Raw(Model.QizSubject.DescIfFine.Replace("\r", "<br/>"))
                    </div>
                </td>
            </tr>                        
            }

            if (hastixing)
            {
            <script language="javascript" type="text/javascript">
                $(function () {
                    alert("我们对您的情况给出了一些常规建议，请查看并采取合适的措施。");
                });
            </script>
            }
        }
    </table>
</div>
